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,CAAS,EACxD,MAAO,GAAAhC,EAAAI,GAAA,EAAC6B,EAAAA,CAAUA,CAAAA,CAACC,SAAU,YAAOF,GACtC","sources":["webpack://_N_E/?25fa","webpack://_N_E/./components/services/api.ts","webpack://_N_E/./components/services/quick-action.tsx","webpack://_N_E/./pages/hosting/services/[slug].tsx","webpack://_N_E/"],"sourcesContent":["\n (window.__NEXT_P = window.__NEXT_P || []).push([\n \"/hosting/services/[slug]\",\n function () {\n return require(\"private-next-pages/hosting/services/[slug].tsx\");\n }\n ]);\n if(module.hot) {\n module.hot.dispose(function () {\n window.__NEXT_P.push([\"/hosting/services/[slug]\"])\n });\n }\n ","import { API_URL, superFetch } from \"@/lib/utils\";\n\nexport async function fetchCreateService(data: any) {\n const response = await superFetch(`${API_URL}/services`, {\n method: \"POST\",\n body: JSON.stringify(data),\n });\n return response as any;\n}\n\nexport async function fetchServiceDetail(slug: string) {\n const response = await fetch(`${API_URL}/services/${slug}`);\n const data = await response.json();\n return data;\n}\n\nexport async function fetchOrgServices() {\n const response = (await superFetch(`${API_URL}/orgs/services`)) as any;\n return response.data;\n}\n\nexport async function fetchOrgServiceDetail(url: any[]) {\n const res = (await superFetch(`${API_URL}${url[0]}`)) as any;\n return res.data.service;\n}\n\nexport async function fetchUpdateService(slug: string | undefined, data: any) {\n const response = await superFetch(`${API_URL}/services/${slug}`, {\n method: \"PUT\",\n body: JSON.stringify(data),\n });\n return response as any;\n}\n\nexport function transformServiceData(values: any, state: any) {\n const { prices_with_extra } = values;\n const external_price = Number(prices_with_extra?.External?.value || 0);\n const prices = Object.keys(prices_with_extra).reduce(\n (acc, key) => {\n acc[key] = Number(prices_with_extra[key].value || 0);\n return acc;\n },\n {} as Record,\n );\n const data = {\n ...values,\n external_price,\n access_guidelines: \"\",\n prices_with_extra,\n prices,\n state,\n } as any;\n\n if (values.form_id) {\n data.form_id = Number(values.form_id);\n } else {\n data.form_id = null;\n }\n if (values.turn_around_time) {\n data.turn_around_time = Number(values.turn_around_time);\n } else {\n data.turn_around_time = null;\n }\n return data;\n}\n","import Link from \"next/link\";\nimport { useState } from \"react\";\n\nimport { fetchUpdateService } from \"@/components/services/api\";\nimport { Button } from \"@/components/ui/button\";\nimport useAuthStore from \"@/stores/auth-store\";\n\nexport default function QuickAction({ service, mutate }: any) {\n const [isLoading, setIsLoading] = useState(false);\n const { user } = useAuthStore();\n\n if (!service || service?.org?.id !== user?.org?.id) return null;\n\n return (\n
\n
\n You are seeing the preview of your service listing. If you wish to edit\n the information below, please click “Edit” to proceed.\n
\n
\n {!isLoading && (\n {\n setIsLoading(true);\n fetchUpdateService(service.slug, {\n state: service.state === \"listed\" ? \"unlisted\" : \"listed\",\n }).finally(() => {\n setIsLoading(false);\n if (mutate) mutate();\n });\n }}\n busy={false}\n className=\"h-12 w-[166px]\"\n >\n {service.state === \"listed\" ? \"Unlist\" : \"List\"}\n \n )}\n \n Edit\n \n
\n
\n );\n}\n","import { NextPageContext } from \"next\";\nimport Head from \"next/head\";\nimport useSWR from \"swr\";\n\nimport { NotFound } from \"@/components/common/notfound\";\nimport { Loading } from \"@/components/loading\";\nimport MainLayout from \"@/components/main-layout\";\nimport { fetchServiceDetail } from \"@/components/services/api\";\nimport QuickAction from \"@/components/services/quick-action\";\nimport { ServiceDetail } from \"@/components/services/v2/service-detail\";\nimport { renderFirstParagraph } from \"@/lib/text\";\nimport { superFetchData } from \"@/lib/utils\";\n\nexport async function getServerSideProps(context: NextPageContext) {\n const { slug } = context.query;\n\n const { data } = (await fetchServiceDetail(slug as string)) as any;\n\n return {\n props: data || { slug },\n };\n}\n\ninterface Props {\n service: any;\n slug?: string;\n}\n\nexport default function ServiceDetailPage(props: Props) {\n const { data, isLoading, mutate } = useSWR(\n `/services/${props.service?.slug || props.slug}`,\n superFetchData,\n { fallbackData: props },\n );\n\n const title = `${data?.service?.name} | Second Lab`;\n\n if (!data?.service && isLoading) return ;\n if (!data?.service) return ;\n\n const image = data.service.photos?.[0] || \"\";\n\n const service = data.service;\n const description = renderFirstParagraph(service.description);\n\n return (\n <>\n \n {title}\n \n\n \n \n \n \n\n \n \n \n \n \n \n ;\n \n );\n}\n\nServiceDetailPage.getLayout = function getLayout(page: any) {\n return {page};\n};\n"],"names":["window","__NEXT_P","push","__webpack_require__","fetchCreateService","data","response","superFetch","concat","API_URL","method","body","JSON","stringify","fetchOrgServiceDetail","url","res","service","fetchUpdateService","slug","transformServiceData","values","state","prices_with_extra","external_price","Number","External","value","prices","Object","keys","reduce","acc","key","access_guidelines","form_id","turn_around_time","QuickAction","param","user","mutate","isLoading","setIsLoading","useState","useAuthStore","org","id","jsx_runtime","jsxs","div","className","jsx","Button","variant","onClick","finally","busy","Link","href","ServiceDetailPage","props","useSWR","superFetchData","fallbackData","title","name","Loading","NotFound","image","photos","description","renderFirstParagraph","Fragment","Head","meta","content","property","ServiceDetail","getLayout","page","MainLayout","isPublic"],"sourceRoot":""}